import * as THREE from 'three'
import EventEmitter from 'events'
import Experience from '../General/Experience'
import Sizes from '../Utils/Sizes'
import Resource from '../Utils/Resource'
import Camera from '../General/Camera'
import Room from './Room'
import Environment from './Environment'
export default class World extends EventEmitter {
  experience!: Experience
  canvas!: HTMLCanvasElement
  scene!: THREE.Scene
  camera!: Camera
  renderer!: THREE.WebGLRenderer
  sizes!: Sizes
  room!: Room
  resource!: Resource
  environment!: Environment
  constructor() {
    super()
    this.experience = new Experience()
    const { scene, sizes, canvas, camera, resource } = this.experience
    this.sizes = sizes
    this.scene = scene
    this.canvas = canvas
    this.camera = camera
    this.resource = resource
    this.resource.on('ready', () => {
      this.room = new Room()
      this.environment = new Environment()
      this.emit('worldready')
    })
  }
  resize() {}
  update() {}
}
